package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.ExhibitionSettlementCompanyTypeEnum;
import com.eastfair.venueservice.enumeration.ExhibitionSettlementSettleStatusEnum;
import com.eastfair.venueservice.enumeration.ExhibitionSettlementRefundStatusEnum;
import com.eastfair.venueservice.enumeration.ExhibitionSettlementInvoicingStatusEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 结算记录
 * </p>
 *
 * @author linan
 * @since 2023-05-26
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("vsm_exhibition_settlement")
@ApiModel(value = "ExhibitionSettlement", description = "结算记录")
@AllArgsConstructor
public class ExhibitionSettlement extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 最新结算日期
     */
    @ApiModelProperty(value = "最新结算日期")
    @TableField(value = "settlement_time")
    @Excel(name = "最新结算日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime settlementTime;

    /**
     * 场馆综合展会ID
     */
    @ApiModelProperty(value = "场馆综合展会ID")
    @TableField(value = "exhibition_manage_id")
    @Excel(name = "场馆综合展会ID")
    private Long exhibitionManageId;

    /**
     * 结算单号
     */
    @ApiModelProperty(value = "结算单号")
    @Size(max = 255, message = "结算单号长度不能超过255")
    @TableField(value = "settlement_no", condition = LIKE)
    @Excel(name = "结算单号")
    private String settlementNo;

    /**
     * 企业类型 #{HOME_SERVICE_PROVIDER:主场服务商;MAIN_TRANSPORT_SERVICE_PROVIDER:主运服务商;MATCHING_SERVICE_PROVIDER:配套服务商}
     */
    @ApiModelProperty(value = "企业类型 #{HOME_SERVICE_PROVIDER:主场服务商;MAIN_TRANSPORT_SERVICE_PROVIDER:主运服务商;MATCHING_SERVICE_PROVIDER:配套服务商}")
    @TableField(value = "company_type")
    @Excel(name = "企业类型 #{HOME_SERVICE_PROVIDER:主场服务商;MAIN_TRANSPORT_SERVICE_PROVIDER:主运服务商;MATCHING_SERVICE_PROVIDER:配套服务商}", replace = {"主场服务商_HOME_SERVICE_PROVIDER", "主运服务商_MAIN_TRANSPORT_SERVICE_PROVIDER", "配套服务商_MATCHING_SERVICE_PROVIDER",  "_null"})
    private ExhibitionSettlementCompanyTypeEnum companyType;

    /**
     * 企业id
     */
    @ApiModelProperty(value = "企业id")
    @TableField(value = "company_id")
    @Excel(name = "企业id")
    private Long companyId;

    /**
     * 企业名称
     */
    @ApiModelProperty(value = "企业名称")
    @Size(max = 255, message = "企业名称长度不能超过255")
    @TableField(value = "company_name", condition = LIKE)
    @Excel(name = "企业名称")
    private String companyName;

    /**
     * 结算金额
     */
    @ApiModelProperty(value = "结算金额")
    @TableField(value = "settlement_amount")
    @Excel(name = "结算金额")
    private BigDecimal settlementAmount;

    /**
     * 已收款
     */
    @ApiModelProperty(value = "已收款")
    @TableField(value = "received")
    @Excel(name = "已收款")
    private BigDecimal received;

    /**
     * 应收款
     */
    @ApiModelProperty(value = "应收款")
    @TableField(value = "receivables")
    @Excel(name = "应收款")
    private BigDecimal receivables;

    /**
     * 开票状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;INVOICED:已开票;REJECTED:被驳回}
     */
    @ApiModelProperty(value = "开票状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;INVOICED:已开票;REJECTED:被驳回}")
    @TableField(value = "invoicing_status")
    @Excel(name = "开票状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;INVOICED:已开票;REJECTED:被驳回}", replace = {"未申请_NOT_APPLIED", "已申请_REQUESTED", "已开票_INVOICED", "被驳回_REJECTED",  "_null"})
    private ExhibitionSettlementInvoicingStatusEnum invoicingStatus;

    /**
     * 应开票金额
     */
    @ApiModelProperty(value = "应开票金额")
    @TableField(value = "invoiced_amount")
    @Excel(name = "应开票金额")
    private BigDecimal invoicedAmount;

    /**
     * 已开票金额
     */
    @ApiModelProperty(value = "已开票金额")
    @TableField(value = "has_invoiced_amount")
    @Excel(name = "已开票金额")
    private BigDecimal hasInvoicedAmount;

    /**
     * 退款状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;REFUNDED:已退款;NO_REFUND:无须退款;REJECTED:被驳回}
     */
    @ApiModelProperty(value = "退款状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;REFUNDED:已退款;NO_REFUND:无须退款;REJECTED:被驳回}")
    @TableField(value = "refund_status")
    @Excel(name = "退款状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;REFUNDED:已退款;NO_REFUND:无须退款;REJECTED:被驳回}", replace = {"未申请_NOT_APPLIED", "已申请_REQUESTED", "已退款_REFUNDED", "无须退款_NO_REFUND", "被驳回_REJECTED",  "_null"})
    private ExhibitionSettlementRefundStatusEnum refundStatus;

    /**
     * 应退金额
     */
    @ApiModelProperty(value = "应退金额")
    @TableField(value = "refund_amount")
    @Excel(name = "应退金额")
    private BigDecimal refundAmount;

    /**
     * 结算状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;HAS_SETTLE:已结算}
     */
    @ApiModelProperty(value = "结算状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;HAS_SETTLE:已结算}")
    @TableField(value = "settle_status")
    @Excel(name = "结算状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;HAS_SETTLE:已结算}", replace = {"未申请_NOT_APPLIED", "已申请_REQUESTED", "已结算_HAS_SETTLE",  "_null"})
    private ExhibitionSettlementSettleStatusEnum settleStatus;

    /**
     * 展馆编码
     */
    @ApiModelProperty(value = "展馆编码")
    @Size(max = 64, message = "展馆编码长度不能超过64")
    @TableField(value = "space_code", condition = LIKE)
    @Excel(name = "展馆编码")
    private String spaceCode;

    /**
     * 展馆号
     */
    @ApiModelProperty(value = "展馆号")
    @Size(max = 100, message = "展馆号长度不能超过100")
    @TableField(value = "space_name", condition = LIKE)
    @Excel(name = "展馆号")
    private String spaceName;

    /**
     * 展位编码
     */
    @ApiModelProperty(value = "展位编码")
    @Size(max = 64, message = "展位编码长度不能超过64")
    @TableField(value = "site_code", condition = LIKE)
    @Excel(name = "展位编码")
    private String siteCode;

    /**
     * 展位号
     */
    @ApiModelProperty(value = "展位号")
    @Size(max = 100, message = "展位号长度不能超过100")
    @TableField(value = "site_name", condition = LIKE)
    @Excel(name = "展位号")
    private String siteName;

    /**
     * 服务结算金额
     */
    @ApiModelProperty(value = "服务结算金额")
    @TableField(value = "total_service_price")
    @Excel(name = "服务结算金额")
    private BigDecimal totalServicePrice;

    /**
     * 服务已收款
     */
    @ApiModelProperty(value = "服务已收款")
    @TableField(value = "service_received")
    @Excel(name = "服务已收款")
    private BigDecimal serviceReceived;

    /**
     * 服务应收款
     */
    @ApiModelProperty(value = "服务应收款")
    @TableField(value = "service_receivables")
    @Excel(name = "服务应收款")
    private BigDecimal serviceReceivables;

    /**
     * 附加费结算金额
     */
    @ApiModelProperty(value = "附加费结算金额")
    @TableField(value = "total_surcharge")
    @Excel(name = "附加费结算金额")
    private BigDecimal totalSurcharge;

    /**
     * 附加费服务已收款
     */
    @ApiModelProperty(value = "附加费服务已收款")
    @TableField(value = "surcharge_received")
    @Excel(name = "附加费服务已收款")
    private BigDecimal surchargeReceived;

    /**
     * 附加费服务应收款
     */
    @ApiModelProperty(value = "附加费服务应收款")
    @TableField(value = "surcharge_receivables")
    @Excel(name = "附加费服务应收款")
    private BigDecimal surchargeReceivables;

    /**
     * 优惠金额
     */
    @ApiModelProperty(value = "优惠金额")
    @TableField(value = "discount_amount")
    @Excel(name = "优惠金额")
    private BigDecimal discountAmount;

    /**
     * 违规罚款金额
     */
    @ApiModelProperty(value = "违规罚款金额")
    @TableField(value = "violation_punish")
    @Excel(name = "违规罚款金额")
    private BigDecimal violationPunish;

    /**
     * 保证金实缴金额
     */
    @ApiModelProperty(value = "保证金实缴金额")
    @TableField(value = "bond_amount")
    @Excel(name = "保证金实缴金额")
    private BigDecimal bondAmount;

    /**
     * 保证金应缴金额
     */
    @ApiModelProperty(value = "保证金应缴金额")
    @TableField(value = "payable_bond_amount")
    @Excel(name = "保证金应缴金额")
    private BigDecimal payableBondAmount;

    /**
     * 合计应收金额
     */
    @ApiModelProperty(value = "合计应收金额")
    @TableField(value = "total_receivables")
    @Excel(name = "合计应收金额")
    private BigDecimal totalReceivables;


    @Builder
    public ExhibitionSettlement(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    LocalDateTime settlementTime, Long exhibitionManageId, String settlementNo, ExhibitionSettlementCompanyTypeEnum companyType, Long companyId, String companyName, 
                    BigDecimal settlementAmount, BigDecimal received, BigDecimal receivables, ExhibitionSettlementInvoicingStatusEnum invoicingStatus, BigDecimal invoicedAmount, BigDecimal hasInvoicedAmount, 
                    ExhibitionSettlementRefundStatusEnum refundStatus, BigDecimal refundAmount, ExhibitionSettlementSettleStatusEnum settleStatus, String spaceCode, String spaceName, String siteCode, 
                    String siteName, BigDecimal totalServicePrice, BigDecimal serviceReceived, BigDecimal serviceReceivables, BigDecimal totalSurcharge, BigDecimal surchargeReceived, 
                    BigDecimal surchargeReceivables, BigDecimal discountAmount, BigDecimal violationPunish, BigDecimal bondAmount, BigDecimal payableBondAmount, BigDecimal totalReceivables) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.settlementTime = settlementTime;
        this.exhibitionManageId = exhibitionManageId;
        this.settlementNo = settlementNo;
        this.companyType = companyType;
        this.companyId = companyId;
        this.companyName = companyName;
        this.settlementAmount = settlementAmount;
        this.received = received;
        this.receivables = receivables;
        this.invoicingStatus = invoicingStatus;
        this.invoicedAmount = invoicedAmount;
        this.hasInvoicedAmount = hasInvoicedAmount;
        this.refundStatus = refundStatus;
        this.refundAmount = refundAmount;
        this.settleStatus = settleStatus;
        this.spaceCode = spaceCode;
        this.spaceName = spaceName;
        this.siteCode = siteCode;
        this.siteName = siteName;
        this.totalServicePrice = totalServicePrice;
        this.serviceReceived = serviceReceived;
        this.serviceReceivables = serviceReceivables;
        this.totalSurcharge = totalSurcharge;
        this.surchargeReceived = surchargeReceived;
        this.surchargeReceivables = surchargeReceivables;
        this.discountAmount = discountAmount;
        this.violationPunish = violationPunish;
        this.bondAmount = bondAmount;
        this.payableBondAmount = payableBondAmount;
        this.totalReceivables = totalReceivables;
    }

}
